
use winit::event_loop::{EventLoop, ControlFlow};

mod app;
mod context;

use crate::app::App;

// 此案例来自：
// https://github.com/w4ngzhen/wgpu_winit_example/blob/main/ch01_render_in_window

fn main() {
    println!("学习 wgpu !");

    env_logger::init();

    let event_loop = EventLoop::new().unwrap();

    // ControlFlow::Poll continuously runs the event loop, even if the OS hasn't
    // dispatched any events. This is ideal for games and similar applications.
    event_loop.set_control_flow(ControlFlow::Poll);

    // ControlFlow::Wait pauses the event loop if no events are available to process.
    // This is ideal for non-game applications that only update in response to user
    // input, and uses significantly less power/CPU time than ControlFlow::Poll.
    event_loop.set_control_flow(ControlFlow::Wait);

    let mut app = App::default();
    let _ = event_loop.run_app(&mut app);
}

